package com.sumainfor.wx.tenant.controller;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.wx.tenant.service.TctenTenantMiddleService;
import com.sumainfor.wx.tenant.service.ZfeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;

/**
 *pc端调用微信租客端
 *
 */
@RestController
@RequestMapping("/key/ZfeignController")
public class ZfeignController {

    @Autowired
    private ZfeignService zfeignService;
    @Autowired
    private TctenTenantMiddleService tctenTenantMiddleService;

    /**
     * 签约时根据手机号查询微信端的租客信息
     * @return
     */
    @GetMapping("/getTenantByTenPhone")
    public JsonResult getTenantByTenPhone(@RequestParam  Map<String,Object> params){
        JsonResult result=new JsonResult();
        Map<String,Object> map=zfeignService.getTenantByTenPhone(params);
        if(map!=null){
            result.put(map);
        }else{
            result.putFailed("服务器繁忙");
        }
        return result;
    }
    /**
     * 市场部 创建工单的时候查询租客端 是否已经注册过 该手机号
     * @return
     */
    @GetMapping("/getTctenForTcmkt")
    public JsonResult getTctenForTcmkt(@RequestParam  Map<String,Object> params){
        JsonResult result=new JsonResult();
        Map<String,Object> map=tctenTenantMiddleService.getTctenForTcmkt(params);
        if(map!=null){
            result.put(map);
        }else{
            result.putFailed("服务器繁忙");
        }
        return result;
    }



    @GetMapping("/getTenId")
    public JsonResult getTenId(@RequestParam Map<String,Object> params){
        JsonResult result = new JsonResult();
        return result.put(zfeignService.getTenId(params));
    }

}
